package com.csun.dsms.service;

import com.csun.dsms.comment.core.support.IService;
import com.csun.dsms.model.domain.DsmsMenu;
import com.csun.dsms.model.domain.DsmsRole;
import com.csun.dsms.model.domain.DsmsUser;
import com.csun.dsms.model.dto.menu.MenuQueryDto;
import com.csun.dsms.model.dto.role.CheckRoleCodeDto;
import com.csun.dsms.model.dto.role.CheckRoleNameDto;
import com.csun.dsms.model.dto.role.RoleBindMenuDto;
import com.csun.dsms.model.vo.menu.BindAuthVo;
import com.csun.dsms.model.vo.role.RoleVo;

import java.util.List;

/**
 * @author chisj chisj@foxmail.com
 * @version 1.0.0
 * @date 2021-09-01 13:19
 * @description: TODO
 */
public interface DsmsRoleService extends IService<DsmsRole> {

    /**
     * 校验角色编码是否已经存在
     *
     * @param checkRoleCodeDto	the check role code dto
     *
     * @return the boolean true-不存在, false-存在
     */
    boolean checkRoleCode(CheckRoleCodeDto checkRoleCodeDto);

    /**
     * 查询角色菜单列表
     *
     * @param menuQueryDto role menu query dto
     *
     * @return the dsms menu list.
     */
    List<DsmsMenu> queryRoleMenuListWithPage(MenuQueryDto menuQueryDto);

    /**
     * Gets menu tree by role id.
     *
     * @param roleId the role id
     *
     * @return the menu tree by role id
     */
    BindAuthVo getMenuTreeByRoleId(Long roleId);

    /**
     * Query role list with page list.
     *
     * @param dsmsRole  the dsms role
     *
     * @return  the role vo list.
     */
    List<RoleVo> queryRoleListWithPage(DsmsRole dsmsRole);

    /**·
     * 根据Id删除角色
     *
     * @param id    the role id
     *
     * @return  the int.
     */
    Integer deleteRoleById(Long id);

    /**
     * 批量删除角色
     *
     * @param roleIdList  the role id list
     *
     * @return  the int.
     */
    Integer batchDeleteByIdList(List<Long> roleIdList);

    /**
     * 修改角色信息
     *
     * @param dsmsRole  the dsms role
     * @param login     the login user
     *
     * @return  the int.
     */
    Integer editRole(DsmsRole dsmsRole, DsmsUser login);

    /**
     * 保存角色信息
     *
     * @param dsmsRole  the dsms role
     * @param login     the login user
     *
     * @return  the int.
     */
    Integer saveRole(DsmsRole dsmsRole, DsmsUser login);

    /**
     * 校验角色名称是否已经存在
     *
     * @param checkRoleNameDto	the check role name dto
     *
     * @return	the boolean true-不存在 false-存在
     */
    boolean checkRoleName(CheckRoleNameDto checkRoleNameDto);

    /**
     * 角色分配权限.
     *
     * @param roleBindMenuDto
     */
    Integer bindMenu(RoleBindMenuDto roleBindMenuDto);

    /**
     * 根据角色编码查询角色
     *
     * @param roleCode  the role code
     *
     * @return
     */
    DsmsRole selectByRoleCode(String roleCode);
}
